<%--
  Created by IntelliJ IDEA.
  User: ZYT
  Date: 2022/5/22
  Time: 20:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>预约挂号界面</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        body{
            overflow-x: hidden;
            color: #666;
        }
        nav{
            width: 100%;
            height: 56px;
            background-color: #39bebe;
        }
        a{
            text-decoration: none;
        }
        div h1{
            text-align: center;
            color: #39bebe;
            display: block;
            margin-bottom: 30px;
        }
        nav>span>a,nav>a{
            display: inline-block;
            float: left;
            height: 26px;
            margin: 14px 20px 0 0;
            padding-left: 10px;
            border-left: 1px solid #E0E0E0;
            font-weight: normal;
            font-size: 18px;
            line-height: 24px;
            color: #fff;
            text-decoration: none;
        }
        nav>span>a:hover{
            text-decoration: underline;
            cursor: pointer;
        }
        nav>a:hover{
            text-decoration: underline;
            cursor: pointer;
        }
        nav>span{
            position: relative;
            left: 1270px;
        }
        nav>a{
            position: relative;
            text-decoration: none;
            left: 1270px;
        }
        .c1{
            position: absolute;
            top: 100px;
            left:50%;
            margin-left:-300px;
        }
        .a_input{
            width: 180px;
            height: 30px;
        }
        .btn{
            width: 102px;
            height: 34px;
            line-height: 34px;
            text-align: center;
            background-color: #38abbb;
            color: white;
            cursor: pointer;
            border: 0;
            border-radius: 3px;
            margin: 0;
            padding: 0;
        }
    </style>
    <script type="text/javascript" src="../static/js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#submit").click(function () {
                var department = $("#data1").val();
                var doctor = $("#data2").val();
                var category = $("#data3").val();
                var sitting_time = $("#data4").val();
                var order_number = $("#data5").val();
                var d_week =$("#data6").val(), myArr;
                $.ajax({
                    type:"post",
                    url:"http://localhost:9090/hospital/P_QueryServlet",
                    data:{"department":department,"doctor":doctor,"category":category,"sitting_time":sitting_time,"order_number":order_number,"d_week":d_week},
                    dataType:"json",
                    tradition:true,
                    success:function (data) {
                        var array=data;
                        var html="";
                        for(var i=0;i<array.length;i++){
                            // alert("提交成功"+array[i].d_sex);
                           html=html+"<tr><td name='d_id'>"+array[i].d_id+"</td><td name='d_name'>"+array[i].d_name+"</td><td>"+array[i].d_age+"</td><td>"+array[i].d_grade+"</td><td>"+array[i].d_department+"</td><td>"+array[i].d_sex+"</td><td>"+array[i].sitting_time+"</td><td>"+array[i].d_week+"</td><td><a href=\"../acceptOrder?d_id="+array[i].d_id+"&d_week="+array[i].d_week+"&d_name="+array[i].d_name+"&sitting_time="+array[i].sitting_time+"\">预约</a></td>";
                        }
                        $("#div1").html("<center><table border='1px black solid'><tr><th>医生id</th><th>医生名称</th><th>医生年龄</th><th>号种种类</th><th>科室名称</th><th>医生性别</th><th>坐诊时间</th><th>星期数</th><th> </th></tr>"+html+"</table></center>");
                    },
                    error:function () {
                        $("#div1").html("error");
                    }
                })
            })
        })
    </script>
</head>
<body>

<%--导航栏--%>
<nav>
    <span><a href="personal_center2.jsp">个人中心</a></span>
    <a href="register.jsp">退出登录</a>
</nav>

<%--门诊挂号--%>
<div class="c1">
    <h1>门诊挂号</h1>
    <h4>请选择：</h4><br>
    科室名称：<input list="options1" name="department" class="a_input" id="data1">
        <datalist id="options1">
            <option value="口腔科"></option>
            <option value="神经科"></option>
            <option value="妇科"></option>
            <option value="4"></option>
            <option value="5"></option>
        </datalist>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    医生名称：<input list="options2" name="doctor" class="a_input" id="data2">
    <datalist id="options2">
        <option value="张三三"></option>
        <option value="李四四"></option>
        <option value="李响"></option>
        <option value="杨咩咩"></option>
        <option value="5"></option>
    </datalist><br><br>
    号种类别：<input list="options3" name="category" class="a_input" id="data3">
    <datalist id="options3">
        <option value="专家"></option>
        <option value="普通"></option>
    </datalist>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    坐诊时间：<input list="options4" name="sitting_time" class="a_input" id="data4">
    <datalist id="options4">
        <option value="上午"></option>
        <option value="下午"></option>
        <option value="晚上"></option>
    </datalist><br><br>
    可预约数：<input list="options5" name="order_number" class="a_input" id="data5">
    <datalist id="options5">
        <option value="1"></option>
        <option value="2"></option>
        <option value="3"></option>
        <option value="4"></option>
        <option value="5"></option>
    </datalist>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;星期数：<input list="options6" name="d_week" class="a_input" id="data6">
        <datalist id="options6">
            <option value="1"></option>
            <option value="2"></option>
            <option value="3"></option>
            <option value="4"></option>
            <option value="5"></option>
            <option value="6"></option>
            <option value="7"></option>
        </datalist><br><br><br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="submit" value="查询" class="btn" id="submit">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" name="submit" value="返回个人中心" class="btn" onclick="window.location.href='personal_center2.jsp'" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="button" name="submit" value="打印" class="btn" onclick="window.location.href='../pages/print/p-print.jsp'">
</div>
<div id="div1" style="position: relative;top: 400px"></div>
</body>
</html>
